#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>

typedef long long ll;

using namespace std;

int main()
{
    ll n, a, b;
    cin >> n >> a >> b;
    for (ll i = a; i < b; i++)
    {
        string s = to_string(i);
        int sz = s.size();
        int flag = 0;
        for (int i = 1; i < sz; i++)
        {
            if (i % 2)
            {
                if (s[i] != '2' && s[i] != '4' && s[i] != '6' && s[i] != '8')
                {
                    flag = 1;
                    break;
                }
            }
            else if (i == 2)
            {
                if (s[i] == '8')
                {
                    flag = 1;
                    break;
                }
            }
            else if (i == 4)
            {
                if (s[i] != '0' && s[i] != '5')
                {
                    flag = 1;
                    break;
                }
            }
        }
        if (!flag)
		cout << i << endl; 
    }
    return 0;
}
